Skip to content
This repository has been archived by the owner on Dec 26, 2024. It is now read-only.

feat(storage): add dump storage table to file utility #1239

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

Yael-Starkware
Copy link
Contributor

@Yael-Starkware Yael-Starkware commented Oct 3, 2023

Pull Request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this introduce a breaking change?

  • Yes
  • No

Other information


This change is Reviewable

@codecov
Copy link

codecov bot commented Oct 3, 2023

Codecov Report

Merging #1239 (7f2ccc2) into main (62bc244) will decrease coverage by 0.07%.
The diff coverage is 56.25%.

@@            Coverage Diff             @@
##             main    #1239      +/-   ##
==========================================
- Coverage   71.84%   71.78%   -0.07%     
==========================================
  Files          80       81       +1     
  Lines        7810     7842      +32     
  Branches     7810     7842      +32     
==========================================
+ Hits         5611     5629      +18     
- Misses       1300     1307       +7     
- Partials      899      906       +7     
Files Coverage Δ
crates/papyrus_storage/src/lib.rs 59.20% <ø> (ø)
crates/papyrus_storage/src/utils.rs 56.25% <56.25%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@OmriEshhar1 OmriEshhar1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @Yael-Starkware)


crates/papyrus_storage/src/utils.rs line 13 at r1 (raw file):

use crate::{open_storage, StorageConfig, StorageResult, StorageTxn};

/// dumps a table from the storage to a file in JSON format

Fix grammar - Capitalize first word, put "." at end of sentence. (x2)


crates/papyrus_storage/src/utils.rs line 26 at r1 (raw file):

    let mut cursor = table_handle.cursor(&txn.txn)?;
    let iter = DbIter::new(&mut cursor);
    let file = File::create(file_path)?;

what happens if the file already exists?
what happens if the directory doesn't exist?
do we want to handle / document faulty scenarios?


crates/papyrus_storage/src/utils.rs line 41 at r1 (raw file):

}

/// dumps the declared classes table from the storage to a file

declared_classes

Code quote:

declared classes

@Yael-Starkware Yael-Starkware force-pushed the yael/dump_storage_table_to_file branch from d600d56 to b9b358d Compare October 3, 2023 12:00
Copy link
Contributor Author

@Yael-Starkware Yael-Starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @OmriEshhar1)


crates/papyrus_storage/src/utils.rs line 13 at r1 (raw file):

Previously, OmriEshhar1 wrote…

Fix grammar - Capitalize first word, put "." at end of sentence. (x2)

Done.


crates/papyrus_storage/src/utils.rs line 26 at r1 (raw file):

Previously, OmriEshhar1 wrote…

what happens if the file already exists?
what happens if the directory doesn't exist?
do we want to handle / document faulty scenarios?

if the file exists then it's content will be reset.
id a directory doesn't exist, the error will be passed with the ? operator.
any faulty scenario is returned from the function. I will make sure to print the error clearly in the main function.


crates/papyrus_storage/src/utils.rs line 41 at r1 (raw file):

Previously, OmriEshhar1 wrote…

declared_classes

Done.

@Yael-Starkware Yael-Starkware force-pushed the yael/dump_storage_table_to_file branch from b9b358d to 7f2ccc2 Compare October 3, 2023 12:21
Copy link
Contributor

@OmriEshhar1 OmriEshhar1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Yael-Starkware)

@Yael-Starkware Yael-Starkware added this pull request to the merge queue Oct 3, 2023
Merged via the queue into main with commit dc0b3cd Oct 3, 2023
@Yael-Starkware Yael-Starkware deleted the yael/dump_storage_table_to_file branch October 3, 2023 12:41
@github-actions github-actions bot locked and limited conversation to collaborators Oct 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants